home *** CD-ROM | disk | FTP | other *** search
- Path: sundog.tiac.net!usenet
- From: mao@tiac.net (Mark A. Odell)
- Newsgroups: comp.lang.c
- Subject: Re: given: char foo[80]; there is no such thing as element foo[80] correct? (i.e. foo[80] = '\0' is beyond the array boundary)
- Date: Sat, 16 Mar 1996 14:36:13 GMT
- Organization: None!
- Message-ID: <314ad16d.86316693@news>
- References: <3148DBB6.1353@hawaii.edu> <1996Mar15.183302.5364@zcon.com>
- Reply-To: mao@tiac.net
- NNTP-Posting-Host: cygnus.tiac.net
- X-Newsreader: Forte Agent .99d/32.182
-
- On Fri, 15 Mar 1996 18:33:02 GMT, szh@zcon.com (Syed Zaeem Hosain) wrote:
-
- >In article <3148DBB6.1353@hawaii.edu>, Dave Carien <davec@hawaii.edu> writes:
- >>Yes or no on this, I just recently got confused by two different books. I
- >>assume that the declaration foo[80] allocates storage for elements 0-79.
-
- // Yes. This works nice and safely for any array of known size.
- foo[sizeof(foo)-1] = '\0';
-
-
-
- +---------------------------------------------------+
- | |
- | Mark A. Odell mao@tiac.net |
- | |
- +---------------------------------------------------+
-